package com.example.demo.service;

import com.example.demo.entity.Person;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-05-10
 * Time: 10:25
 */
@Service
@RestController
public class PersonService {

    private final Person person;


    public PersonService(Person person) {
        this.person = person;
    }

    @RequestMapping("/usePerson")
    public String UsePerson() {

        String name = person.getName();
        int age = person.getAge();
        return "name: " + name + " age: " + age;
    }
//    @PostConstruct
//    public void fun() {
//        System.out.println(person);
//    }
}
